<include file="Common:layout" />
<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3>商品分类 - 添加分类</h3>
            </div>
        </div>
    </div>

    <form action="{:U('Category/add_cate')}" method="post" class="form-horizontal" id="category_form">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label><em>*</em>分类名称</label>
                </dt>
                <dd class="opt">
                    <input type="text" placeholder="名称" class="input-txt" name="c_name" value="" id="c_name">
                    <span class="err" style="color:#F00; display:none;"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label><em>*</em>分类展示图片</label>
                </dt>
                <dd class="opt">
                    <div class="input-file-show">
                        <span class="show">
                            <a id="img_a" target="_blank" class="nyroModal" rel="gal" href="">
                                <i id="img_i" class="fa fa-picture-o" onmouseover="layer.tips('<img src=>',this,{tips: [1, '#fff']});" onmouseout="layer.closeAll();"></i>
                            </a>
                        </span>
                        <span class="type-file-box">
                            <input type="text" id="image" name="image" value="" class="type-file-text">
                            <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">
                            <input class="type-file-file" onClick="GetUploadify(1,'','category','img_call_back')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效">
                        </span>
                    </div>
                    <span class="err"></span>
                    <p class="notic">请上传图片格式文件</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="t_sort"><em>*</em>排序</label>
                </dt>
                <dd class="opt">
                    <input type="text" class="t_mane" name="sort" id="t_sort" data-type="number">
                    <p class="notic">根据排序进行由小到大排列显示。</p>
                </dd>
            </dl>
            <div class="bot"><a id="submitBtn" class="ncap-btn-big ncap-btn-green" href="JavaScript:void(0);">确认提交</a></div>
        </div>
    </form>
</div>
<script>
    function img_call_back(fileurl_tmp)
    {
        $("#image").val(fileurl_tmp);
        $("#img_a").attr('href', fileurl_tmp);
        $("#img_i").attr('onmouseover', "layer.tips('<img src="+fileurl_tmp+">',this,{tips: [1, '#fff']});");
    }
    //分类的验证
    $("#submitBtn").click(function() {
        var c_name = $('#c_name').val();
        var image = $('#image').val();
        if (c_name == '') {
            layer.msg('请填写分类名称!',{icon: 2,time:1000});
            return false;
        }
        if (image == '') {
            layer.msg('请上传分类图片!',{icon: 2,time:1000});
            return false;
        }

        $("#category_form").submit();
    });
</script>
</body>
</html>